package com.ruoyi.yf.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yf.mapper.YfClientVersionMapper;
import com.ruoyi.yf.domain.YfClientVersion;
import com.ruoyi.yf.service.IYfClientVersionService;
import com.ruoyi.common.core.text.Convert;

/**
 * 客户端 版本更新Service业务层处理
 * 
 * @author XiaoYi...
 * @date 2020-04-08
 */
@Service
public class YfClientVersionServiceImpl implements IYfClientVersionService 
{
    @Autowired
    private YfClientVersionMapper yfClientVersionMapper;

    /**
     * 查询客户端 版本更新
     * 
     * @param id 客户端 版本更新ID
     * @return 客户端 版本更新
     */
    @Override
    public YfClientVersion selectYfClientVersionById(Long id)
    {
        return yfClientVersionMapper.selectYfClientVersionById(id);
    }

    /**
     * 查询客户端 版本更新列表
     * 
     * @param yfClientVersion 客户端 版本更新
     * @return 客户端 版本更新
     */
    @Override
    public List<YfClientVersion> selectYfClientVersionList(YfClientVersion yfClientVersion)
    {
        return yfClientVersionMapper.selectYfClientVersionList(yfClientVersion);
    }

    /**
     * 新增客户端 版本更新
     * 
     * @param yfClientVersion 客户端 版本更新
     * @return 结果
     */
    @Override
    public int insertYfClientVersion(YfClientVersion yfClientVersion)
    {
        yfClientVersion.setCreateTime(DateUtils.getNowDate());
        return yfClientVersionMapper.insertYfClientVersion(yfClientVersion);
    }

    /**
     * 修改客户端 版本更新
     * 
     * @param yfClientVersion 客户端 版本更新
     * @return 结果
     */
    @Override
    public int updateYfClientVersion(YfClientVersion yfClientVersion)
    {
        yfClientVersion.setUpdateTime(DateUtils.getNowDate());
        return yfClientVersionMapper.updateYfClientVersion(yfClientVersion);
    }

    /**
     * 删除客户端 版本更新对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteYfClientVersionByIds(String ids)
    {
        return yfClientVersionMapper.deleteYfClientVersionByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除客户端 版本更新信息
     * 
     * @param id 客户端 版本更新ID
     * @return 结果
     */
    @Override
    public int deleteYfClientVersionById(Long id)
    {
        return yfClientVersionMapper.deleteYfClientVersionById(id);
    }

    /**
     *  查询app最新版本
     *
     * @param type
     * @param updateRegion
     * @return
     */
    @Override
    public YfClientVersion getAppVersionByTypeAndRegion(String type, String updateRegion) {
        return yfClientVersionMapper.getAppVersionByTypeAndRegion(type,updateRegion);
    }


    // 查询app最新版本 -- 暂不使用暂存点
    @Override
    public YfClientVersion getAppVersionByCondition(String type, String updateRegion) {
        return yfClientVersionMapper.getAppVersionByCondition(type,updateRegion);
    }

}
